capture log close
clear all
set maxvar 10000
set more off
pause off
# delimit;

/* 
Figure B10
*/

local data "" ;
local output "" ;

foreach gp in all parhigh parlow white black { ;
	use "prwora_bw264_crime_poly1allcov_iv_`gp'.dta", clear ;
	keep if 
		(
		variables == "n_crime2char_1997_2017" | 
		variables == "n_crime2chart_1997_2017" |
		variables == "n_crime2genr_1997_2017"	| 
		variables == "n_crime2genrt_1997_2017"	|
		variables == "n_crime2nogn_1997_2017" | 
		variables == "n_crime2nognt_1997_2017" | 
		variables == "n_crime2prtf_1997_2017" | 
		variables == "n_crime2prtft_1997_2017" | 
		variables == "n_crime2vrob_1997_2017" | 
		variables == "n_crime2vrobt_1997_2017" | 
		variables == "n_crime2vnrb_1997_2017" | 
		variables == "n_crime2vnrbt_1997_2017" | 
		variables == "n_crime2anti_1997_2017" | 
		variables == "n_crime2antit_1997_2017" | 
		variables == "n_crime2vcps_1997_2017" | 
		variables == "n_crime2vcpst_1997_2017" | 
		variables == "n_crime2prbg_1997_2017" | 
		variables == "n_crime2prbgt_1997_2017" | 
		variables == "n_crime2dgsl_1997_2017" | 
		variables == "n_crime2dgslt_1997_2017" | 
		variables == "n_crime2prfd_1997_2017" | 
		variables == "n_crime2prfdt_1997_2017" | 
		variables == "n_crime2niwp_1997_2017" | 
		variables == "n_crime2niwpt_1997_2017" | 
		variables == "n_crime2hinc_1997_2017" |
		variables == "n_crime2shinc_1997_2017" | 
		variables == "n_crime2ahinc_1997_2017" | 
		variables == "avg_kidemp15_1997_2017")
		& sample == "age18unfav" ;
	foreach stub in 
		char chart genr genrt nogn nognt prtf prtft vrob vrobt vnrb vnrbt anti antit
		vcps vcpst prbg prbgt dgsl dgslt prfd prfdt niwp niwpt hinc shinc ahinc { ;
			replace variables = "age18rd_`stub'"   if variables == "n_crime2`stub'_1997_2017" ;
	} ;
		replace variables = "age18rd_kidemp15" if variables == "avg_kidemp15_1997_2017" ;
	rename n_age18unfav b_endo ;
	rename sen_age18unfav se_endo ;
	keep variables b_endo se_endo mean_rd ;
	gen gp = "`gp'" ;
	gen exp = "age18rd" ;
	tempfile `gp' ;
	save ``gp'' ;
} ;

/* Parent earnings */
local earn1 "parhigh" ;
local earn2 "parlow" ;
local earn1_label "High parent earn" ;
local earn2_label "Low parent earn" ;
local earn1_color "purple" ;
local earn2_color "orange" ;

/* Race */
local race1 "white" ;
local race2 "black" ;
local race1_label "White" ;
local race2_label "Black" ;
local race1_color "teal" ;
local race2_color "olive" ;

local ysc_genrt "0(.5)2" ;
local ysc_ainca "0(.05).2" ;
local ysc_ahinc "0(.05).2" ;

local label_genrt "income-generating charge" ;
local label_ainca "incarceration" ;
local label_ahinc "incarceration" ;


use `all', clear ;		 
append using ``earn1'' ;
append using ``earn2'' ;
append using ``race1'' ;
append using ``race2'' ;

gen treat_lvl = mean_rd + b_endo ;

gen lo95 = treat_lvl - 1.96*se_endo ;
gen hi95 = treat_lvl + 1.96*se_endo ;

/* ************************************ */
/* **** CREATE BLACK/WHITE GRAPHS ***** */
/* ************************************ */


local add_all     	= 0 ;
local add_black 	= .3 ;
local add_white    = -.3 ;

capture drop sort ;
gen sort = . ;

foreach gp in all black white { ;

	replace	sort = 12 + `add_`gp''  if variables == "age18rd_prtft" 	& gp == "`gp'" ;
	replace	sort = 10 + `add_`gp''  if variables == "age18rd_vcpst" 	& gp == "`gp'" ;
	replace	sort = 8  + `add_`gp''  if variables == "age18rd_prfdt" 	& gp == "`gp'" ;
	replace	sort = 6  + `add_`gp''  if variables == "age18rd_vrobt" 	& gp == "`gp'" ;
	replace	sort = 4  + `add_`gp''  if variables == "age18rd_prbgt" 	& gp == "`gp'" ;
	replace	sort = 2  + `add_`gp''  if variables == "age18rd_dgslt" 	& gp == "`gp'" ;
	replace	sort = 0  + `add_`gp''  if variables == "age18rd_vnrbt" 	& gp == "`gp'" ;
	replace	sort = -2  + `add_`gp''  if variables == "age18rd_niwpt" 	& gp == "`gp'" ;
} ;


twoway 

		(rbar hi95 lo95	sort 	if variables == "age18rd_prtft" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vrobt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vcpst" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prbgt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_dgslt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prfdt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vnrbt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_niwpt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		
		(rbar hi95 lo95	sort 	if variables == "age18rd_prtft" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vrobt" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vcpst" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prbgt" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_dgslt" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prfdt" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vnrbt" & gp == "black", color(olive*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_niwpt" & gp == "black", color(olive*.25) barwidth(.2) horizontal)

		(rbar hi95 lo95	sort 	if variables == "age18rd_prtft" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vrobt" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vcpst" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prbgt" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_dgslt" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prfdt" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vnrbt" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_niwpt" & gp == "white", color(teal*.25) barwidth(.2) horizontal)
		
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prtft" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vrobt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vcpst" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prbgt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_dgslt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prfdt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vnrbt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_niwpt" & gp == "all", color(gray) lwidth(medthin))
		
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prtft" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vrobt" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vcpst" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prbgt" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_dgslt" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prfdt" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vnrbt" & gp == "black", color(olive) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_niwpt" & gp == "black", color(olive) lwidth(medthick))
		
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prtft" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vrobt" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vcpst" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prbgt" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_dgslt" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prfdt" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vnrbt" & gp == "white", color(teal) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_niwpt" & gp == "white", color(teal) lwidth(medthick))
		
		(scatter sort mean_rd  	if variables == "age18rd_prtft" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_vrobt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_vcpst" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_prbgt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_dgslt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_prfdt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_vnrbt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_niwpt" & gp == "all", color(gray) msymbol(X))
		
		(scatter sort mean_rd 	if variables == "age18rd_prtft" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_vrobt" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_vcpst" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_prbgt" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_dgslt" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_prfdt" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_vnrbt" & gp == "black", color(olive) msymbol(O) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_niwpt" & gp == "black", color(olive) msymbol(O) msize(small))
		
		(scatter sort mean_rd	if variables == "age18rd_prtft" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_vrobt" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_vcpst" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_prbgt" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_dgslt" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_prfdt" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_vnrbt" & gp == "white", color(teal) msymbol(Oh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_niwpt" & gp == "white", color(teal) msymbol(Oh) msize(small))

		(scatter sort mean_rd if var == "kidem", lcolor(none) lwidth(medthick) yaxis(2))
		
		(pcarrowi 12.85 .275 12.5  .3  "", 	mstyle(none) lwidth(vthin) color(black)) /* For control mean label */
		(pcarrowi 12.5  .45 12.9  .5  "", 	mstyle(none) lwidth(vthin) color(black)) /* for IV estimate label */
		
		, 
		legend(col(3) row(1) order(49 "All" 57 "Black" 65 "White" ))
		xsc(r(-.2 1)) xtitle("Increase in number of charges", size(medsmall))
		xlab(-.2(.2)1)
		ysc(r(-2.5 13) axis(1)) 
		ysc(r(-2.5 13) axis(2)) 
		ytitle("", axis(1)) 
		ytitle("", axis(2))
		ylabel(
		   12 "Theft" 10 "Prostitution" 8 "Fraud/forgery" 6 "Robbery" 4 "Burglary" 2 "Drug distrib" 0 "Non-rob violent" -2 "Weapons", 
		   angle(0) notick labsize(small) /*nogrid*/ axis(1) ) 
		ylabel(
		   12 "Theft" 10 "Prostitution" 8 "Fraud/forgery" 6 "Robbery" 4 "Burglary" 2 "Drug distrib" 0 "Non-rob violent" -2 "Weapons", 
		   angle(0) notick labsize(small) /*nogrid*/ axis(2) ) 
		graphregion(color(white))
		bgcolor(white)
		ylabel(,nogrid angle(0) axis(1))
		ylabel(,nogrid angle(0) axis(2))
		ttext(13 .24 "Control" "mean", size(tiny))
		ttext(13 .56 "IV estimate", size(tiny))
		plotregion(margin(0 2 2 2))  
		xline(0, lcolor(gray) lpattern(dash))
		;
		graph export "`output'/figB10_a.png", width(1000) height(750) replace ;


/* ************************************************* */
/* **** CREATE LOW/HIGH PARENT EARNINGS GRAPHS ***** */
/* ************************************************* */


local add_all     	= 0 ;
local add_parlow 	= .3 ;
local add_parhigh    = -.3 ;

capture drop sort ;
gen sort = . ;

foreach gp in all parlow parhigh { ;

	replace	sort = 12 + `add_`gp''  if variables == "age18rd_prtft" 	& gp == "`gp'" ;
	replace	sort = 10 + `add_`gp''  if variables == "age18rd_vcpst" 	& gp == "`gp'" ;
	replace	sort = 8  + `add_`gp''  if variables == "age18rd_prfdt" 	& gp == "`gp'" ;
	replace	sort = 6  + `add_`gp''  if variables == "age18rd_vrobt" 	& gp == "`gp'" ;
	replace	sort = 4  + `add_`gp''  if variables == "age18rd_prbgt" 	& gp == "`gp'" ;
	replace	sort = 2  + `add_`gp''  if variables == "age18rd_dgslt" 	& gp == "`gp'" ;
	replace	sort = 0  + `add_`gp''  if variables == "age18rd_vnrbt" 	& gp == "`gp'" ;
	replace	sort = -2  + `add_`gp''  if variables == "age18rd_niwpt" 	& gp == "`gp'" ;
} ;


twoway 

		(rbar hi95 lo95	sort 	if variables == "age18rd_prtft" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vrobt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vcpst" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prbgt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_dgslt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prfdt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vnrbt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_niwpt" & gp == "all", color(gray*.25) barwidth(.2) horizontal)
		
		(rbar hi95 lo95	sort 	if variables == "age18rd_prtft" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vrobt" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vcpst" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prbgt" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_dgslt" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prfdt" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vnrbt" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_niwpt" & gp == "parlow", color(orange*.25) barwidth(.2) horizontal)

		(rbar hi95 lo95	sort 	if variables == "age18rd_prtft" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vrobt" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vcpst" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prbgt" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_dgslt" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_prfdt" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_vnrbt" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		(rbar hi95 lo95	sort 	if variables == "age18rd_niwpt" & gp == "parhigh", color(purple*.25) barwidth(.2) horizontal)
		
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prtft" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vrobt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vcpst" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prbgt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_dgslt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prfdt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vnrbt" & gp == "all", color(gray) lwidth(medthin))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_niwpt" & gp == "all", color(gray) lwidth(medthin))
		
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prtft" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vrobt" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vcpst" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prbgt" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_dgslt" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prfdt" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vnrbt" & gp == "parlow", color(orange) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_niwpt" & gp == "parlow", color(orange) lwidth(medthick))
		
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prtft" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vrobt" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vcpst" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prbgt" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_dgslt" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_prfdt" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_vnrbt" & gp == "parhigh", color(purple) lwidth(medthick))
		(pcarrow sort mean_rd sort treat_lvl 	if variables == "age18rd_niwpt" & gp == "parhigh", color(purple) lwidth(medthick))
		
		(scatter sort mean_rd  	if variables == "age18rd_prtft" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_vrobt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_vcpst" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_prbgt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_dgslt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_prfdt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_vnrbt" & gp == "all", color(gray) msymbol(X))
		(scatter sort mean_rd  	if variables == "age18rd_niwpt" & gp == "all", color(gray) msymbol(X))
		
		(scatter sort mean_rd 	if variables == "age18rd_prtft" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_vrobt" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_vcpst" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_prbgt" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_dgslt" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_prfdt" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_vnrbt" & gp == "parlow", color(orange) msymbol(S) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_niwpt" & gp == "parlow", color(orange) msymbol(S) msize(small))
		
		(scatter sort mean_rd	if variables == "age18rd_prtft" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_vrobt" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_vcpst" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_prbgt" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd 	if variables == "age18rd_dgslt" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_prfdt" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_vnrbt" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))
		(scatter sort mean_rd	if variables == "age18rd_niwpt" & gp == "parhigh", color(purple) msymbol(Dh) msize(small))

		(scatter sort mean_rd if var == "kidem", lcolor(none) lwidth(medthick) yaxis(2))
		
		(pcarrowi 12.85 .255 12.5  .28  "", 	mstyle(none) lwidth(vthin) color(black)) /* For control mean label */
		(pcarrowi 12.5  .45 12.9  .5  "", 	mstyle(none) lwidth(vthin) color(black)) /* for IV estimate label */
		
		, 
		legend(col(3) row(1) order(49 "All" 57 "Low parent earn" 65 "High parent earn" ))
		xsc(r(-.2 1)) xtitle("Increase in number of charges", size(medsmall))
		xlab(-.2(.2)1)
		ysc(r(-2.5 13) axis(1)) 
		ysc(r(-2.5 13) axis(2)) 
		ytitle("", axis(1)) 
		ytitle("", axis(2))
		ylabel(
		   12 "Theft" 10 "Prostitution" 8 "Fraud/forgery" 6 "Robbery" 4 "Burglary" 2 "Drug distrib" 0 "Non-rob violent" -2 "Weapons", 
		   angle(0) notick labsize(small) /*nogrid*/ axis(1) ) 
		ylabel(
		   12 "Theft" 10 "Prostitution" 8 "Fraud/forgery" 6 "Robbery" 4 "Burglary" 2 "Drug distrib" 0 "Non-rob violent" -2 "Weapons", 
		   angle(0) notick labsize(small) /*nogrid*/ axis(2) ) 
		graphregion(color(white))
		bgcolor(white)
		ylabel(,nogrid angle(0) axis(1))
		ylabel(,nogrid angle(0) axis(2))
		ttext(13 .22 "Control" "mean", size(tiny))
		ttext(13 .56 "IV estimate", size(tiny))
		plotregion(margin(0 2 2 2)) 
		xline(0, lcolor(gray) lpattern(dash))
		;
		graph export "`output'/figB10_b.png", width(1000) height(750) replace ;

